package com.css.zfzx.sjcj.modules.hddcGeophySvyPoint.repository;

import com.css.zfzx.sjcj.modules.hddcGeophySvyPoint.repository.entity.HddcGeophysvypointEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author zhangcong
 * @date 2020-11-28
 */
public interface HddcGeophysvypointRepository extends JpaRepository<HddcGeophysvypointEntity, String> {
    @Modifying
    @Query(nativeQuery = true,value = "update hddc_geophysvypoint set qualityinspection_status=:s ,extends1=:str where uuid=:uuid")
    void updateStatus(String s, String str, String uuid);

    @Query(nativeQuery = true,value = "select * from hddc_geophysvypoint where is_valid=1 and (qualityinspection_status!=3 or qualityinspection_status is null) ")
    List<HddcGeophysvypointEntity> findByAll();

    @Query(nativeQuery = true,value = "select * from hddc_geophysvypoint where id =?1 and is_valid=1 ")
    HddcGeophysvypointEntity findbyId(String svypointid);

    HddcGeophysvypointEntity findByUuidAndIsValid(String id, String isValid);
}
